package work.linruchang.bean;


import work.linruchang.util.annotation.TableJoin;
import work.linruchang.util.annotation.TableJoinField;
import work.linruchang.util.annotation.TableLeftJoinField;
import work.linruchang.util.bean.wrapper.db.SqlFragment;

import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

@Entity
@NamedQueries({
})
@Table(name = "ct_user_order_msg")
public class UserOrderMsg extends BaseEntity {

    private static final long serialVersionUID = 85709580337441206L;

    /**
     * 订购用户手机号
     */
    @TableJoin(
            tableLeftJoinFields = {
                    @TableLeftJoinField(joinTable = UserBindInfo.class, joinFieldName = "userMobile")
            }
    )
    private String userMobile;

    /**
     * 区县编码
     */
    @TableJoin({
            @TableJoinField(joinSymbol = SqlFragment.LEFT_JOIN, joinTable = UserBindInfo.class, joinFieldName = "areaCode")
    })
    private String regionCode;

    /**
     * 预留字段，可系统写入内容
     */
    private String content;

    /**
     * 状态：0成功，1失败
     */
    private String status;
    public static final String STATUS_SUCCESS = "0";
    public static final String STATUS_FAIL = "1";

    private Long landlordId;

    /**
     * 房东手机号码
     */
    private String landlordMobile;
    private Date createTime;
    private Date updateTime;

    /**
     * 状态：0未读，1已读
     */
    private String isRead;

    /**
     * CRM订单
     * 申请单编码
     */
    private String reqCode;

    /**
     * 销售品名字
     * <p>
     * 【FUNC019单宽订购响应-1292-subscode】
     */
    private String saleProDisName;

    /**
     * 订单编码
     * res.setSaleProSubsId(obj.getSubsid());
     * res.setSaleProSubsCode(obj.getSubscode());
     * 【FUNC019单宽订购响应-1292-subscode】
     */
    private String saleProSubsCode;

    /**
     * 产品信息接入号
     * 【FUNC014-2014004】
     * 【FUNC019单宽订购响应-2002765-accnbr】
     */
    private String proAccNbr;

    /**
     * crm服务码
     * 【FUNC014=2014002】服务编码
     * 【FUNC019单宽订购响应-2002765-servnbr】服务编码
     */
    private String proServCode;

    /**
     * 参考{cn.eshore.service.esb.service.impl.ParamIdMapper#getOldProStatusType()}
     * crm获取到的value编码值，转换本系统的状态编码
     */
    private String proStatus; //crm服务状态码
    private String reason;

    /**
     * 套餐CRM标识
     */
    private String saleProOfferId;

    /**
     * 本系统配置的套餐主键ID
     */
    private Long packId;

    //	private Long packInfoId;
    private String packName;

    /**
     * CRM订购请求体
     */
    private String reqOrgData;

    /**
     * CRM订购响应结果
     */
    private String resOrgData;


    /**
     * 异常单标识(0：默认正常，1：卡单)
     */
    private String unusualMark = "0";

    /**
     * 客户姓名
     */
    private String userName;

    /**
     * 套餐特殊标识（0：普通套餐，1：特资套餐）
     * 参考{PackInfo#specType}
     */
    private String packSpecType;

    /**
     * 特殊套餐关联的公寓标识
     */
    private Long specPackBuildingId;

    /**
     * 渠道标识（app:表示app订购，wx:微信扫码订购）
     *
     * 参考{@link Constants#ORDER_CHANNEL_ID_APP}
     */
    private String channelId;

    /**
     * 楼栋id
     */
    private Long buildId;

    /**
     * 20220222
     * 订单来源：
     * 0或空本系统订购
     * 1ReadCtbbBindTimer定时任务文件解析
     * 2运营手动导入外系统订单
     *
     * 参考{@link Constants#USER_ORDER_SOURCE_LOCAL}
     */
    @Transient
    private String source;

    /**
     * 20220222
     * 数据插入时的时间，
     * 用于针对1ReadCtbbBindTimer定时任务文件解析 2运营手动导入外系统订单 数据真正插入到本系统的时间，
     * create_time用于存储销售品首次竣工日期即订购日期
     */
    @Transient
    private Date sourceTime;

    public Date getSourceTime() {
        return sourceTime;
    }

    public void setSourceTime(Date sourceTime) {
        this.sourceTime = sourceTime;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public Long getBuildId() {
        return buildId;
    }

    public void setBuildId(Long buildId) {
        this.buildId = buildId;
    }

    public String getReqOrgData() {
        return reqOrgData;
    }

    public void setReqOrgData(String reqOrgData) {
        this.reqOrgData = reqOrgData;
    }

    public String getResOrgData() {
        return resOrgData;
    }

    public void setResOrgData(String resOrgData) {
        this.resOrgData = resOrgData;
    }

    public String getUserMobile() {
        return userMobile;
    }

    public void setUserMobile(String userMobile) {
        this.userMobile = userMobile;
    }

    public String getRegionCode() {
        return regionCode;
    }

    public void setRegionCode(String regionCode) {
        this.regionCode = regionCode;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getLandlordId() {
        return landlordId;
    }

    public void setLandlordId(Long landlordId) {
        this.landlordId = landlordId;
    }

    public String getLandlordMobile() {
        return landlordMobile;
    }

    public void setLandlordMobile(String landlordMobile) {
        this.landlordMobile = landlordMobile;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    public String getIsRead() {
        return isRead;
    }

    public void setIsRead(String isRead) {
        this.isRead = isRead;
    }

    public String getReqCode() {
        return reqCode;
    }

    public void setReqCode(String reqCode) {
        this.reqCode = reqCode;
    }

    public String getSaleProDisName() {
        return saleProDisName;
    }

    public void setSaleProDisName(String saleProDisName) {
        this.saleProDisName = saleProDisName;
    }

    public String getSaleProSubsCode() {
        return saleProSubsCode;
    }

    public void setSaleProSubsCode(String saleProSubsCode) {
        this.saleProSubsCode = saleProSubsCode;
    }

    public String getProServCode() {
        return proServCode;
    }

    public void setProServCode(String proServCode) {
        this.proServCode = proServCode;
    }

    public String getProStatus() {
        return proStatus;
    }

    public void setProStatus(String proStatus) {
        this.proStatus = proStatus;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    //	public Long getPackInfoId() {
//		return packInfoId;
//	}
//	public void setPackInfoId(Long packInfoId) {
//		this.packInfoId = packInfoId;
//	}
    public String getPackName() {
        return packName;
    }

    public void setPackName(String packName) {
        this.packName = packName;
    }

    public String getSaleProOfferId() {
        return saleProOfferId;
    }

    public void setSaleProOfferId(String saleProOfferId) {
        this.saleProOfferId = saleProOfferId;
    }

    public Long getPackId() {
        return packId;
    }

    public void setPackId(Long packId) {
        this.packId = packId;
    }

    public String getProAccNbr() {
        return proAccNbr;
    }

    public void setProAccNbr(String proAccNbr) {
        this.proAccNbr = proAccNbr;
    }

    public String getUnusualMark() {
        return unusualMark;
    }

    public void setUnusualMark(String unusualMark) {
        this.unusualMark = unusualMark;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPackSpecType() {
        return packSpecType;
    }

    public void setPackSpecType(String packSpecType) {
        this.packSpecType = packSpecType;
    }

    public Long getSpecPackBuildingId() {
        return specPackBuildingId;
    }

    public void setSpecPackBuildingId(Long specPackBuildingId) {
        this.specPackBuildingId = specPackBuildingId;
    }

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }


    @Override
    public String toString() {
        return "UserOrderMsg{" +
                "userMobile='" + userMobile + '\'' +
                ", regionCode='" + regionCode + '\'' +
                ", content='" + content + '\'' +
                ", status='" + status + '\'' +
                ", landlordId=" + landlordId +
                ", landlordMobile='" + landlordMobile + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", isRead='" + isRead + '\'' +
                ", reqCode='" + reqCode + '\'' +
                ", saleProDisName='" + saleProDisName + '\'' +
                ", saleProSubsCode='" + saleProSubsCode + '\'' +
                ", proAccNbr='" + proAccNbr + '\'' +
                ", proServCode='" + proServCode + '\'' +
                ", proStatus='" + proStatus + '\'' +
                ", reason='" + reason + '\'' +
                ", saleProOfferId='" + saleProOfferId + '\'' +
                ", packId=" + packId +
                ", packName='" + packName + '\'' +
                ", reqOrgData='" + reqOrgData + '\'' +
                ", resOrgData='" + resOrgData + '\'' +
                ", unusualMark='" + unusualMark + '\'' +
                ", userName='" + userName + '\'' +
                ", packSpecType='" + packSpecType + '\'' +
                ", specPackBuildingId=" + specPackBuildingId +
                ", channelId='" + channelId + '\'' +
                ", buildId=" + buildId +
                ", source='" + source + '\'' +
                ", sourceTime=" + sourceTime +
                '}';
    }
}